home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
compre1a
/
msagent.frm
< prev
next >
Wrap
Text File
|
1999-08-29
|
23KB
|
656 lines
VERSION 5.00
Object = "{F5BE8BC2-7DE6-11D0-91FE-00C04FD701A5}#2.0#0"; "AGENTCTL.DLL"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 315
Left = 0
TabIndex = 1
Top = 2880
Width = 4680
_ExtentX = 8255
_ExtentY = 556
Style = 1
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 615
Left = 1260
TabIndex = 0
Top = 1080
Width = 1455
End
Begin AgentObjectsCtl.Agent Agent
Left = 360
Top = 300
_cx = 847
_cy = 847
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Genie As IAgentCtlCharacter
Dim Robby As IAgentCtlCharacter
Dim Merlin As IAgentCtlCharacter
Dim LoadRequest(3)
Dim GetRequest(8)
Dim GenieRequest As IAgentCtlRequest
Dim RobbyRequest As IAgentCtlRequest
Dim MerlinRequest As IAgentCtlRequest
Dim DatapathType As String
Dim CenterX As Integer, CenterY As Integer
Dim RobbyDelayed As Boolean
Dim RobbyLoaded As Boolean
Dim MerlinLoaded As Boolean
Dim RobbyShowFailed As Boolean
Dim MerlinShowFailed As Boolean
Private Sub Agent_Click(ByVal CharacterID As String, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)
If Button = 1 Then
'If we have already loaded Robby, but his Showing state animation failed
If RobbyLoaded = True And RobbyShowFailed = True Then
' Apologize
Genie.Play "Greet"
Genie.Speak "Yes, O Great One. I will attempt to summon Robby again.|As you wish, my master."
' Try again
Set GetRequest(6) = Robby.Get("state", "showing, speaking")
' Otherwise, if we have already loaded Merlin, but his Showing state animation failed
ElseIf MerlinLoaded = True And MerlinShowFailed = True Then
' Apologize
Genie.Speak "Yes, O Noble One. I will attempt to summon Merlin again.|Yes, Master. I will see if I can rouse the wizened one."
' Try again
Set GetRequest(7) = Merlin.Get("state", "showing, speaking")
Else ' We haven't loaded either character yet, so just ignore the click.
Exit Sub
End If
End If
End Sub
Private Sub Agent_RequestComplete(ByVal Request As Object)
Select Case Request
Case LoadRequest(1)
If Request.Status <> 0 Then
' If genie's character data fails to load post a message
StatusBar1.SimpleText = "Genie character failed to load."
MsgBox "Unable to load the Genie character. Please try refreshing this page."
Else
StatusBar1.SimpleText = "Genie character successfully loaded."
' Create a reference to the character
Set Genie = Agent.Characters("genie")
' Load the character's Showing and Speaking state animations
Set GetRequest(1) = Genie.Get("state", "showing,speaking")
StatusBar1.SimpleText = "Now loading Genie's Showing and Speaking state animations."
End If
Case LoadRequest(2)
If Request.Status <> 0 Then
StatusBar1.SimpleText = "Robby character failed to load."
RobbyLoaded = False
Genie.Speak "Uh oh, Robby failed to load."
Genie.Speak "Try refreshing this page."
Else
StatusBar1.SimpleText = "Robby character successfully loaded."
RobbyLoaded = True
Set Robby = Agent.Characters("robby")
Set GetRequest(6) = Robby.Get("state", "showing,speaking")
StatusBar1.SimpleText = "Loading Robby's Showing and Speaking state animations."
End If
Case LoadRequest(3)
If Request.Status <> 0 Then
StatusBar1.SimpleText = "Merlin character failed to load."
MerlinLoaded = False
Genie.Play "Greet"
Genie.Speak "Ten thousand pardons, O Merciful One. Merlin was not available."
Genie.Speak "When we're done, you can try refreshing this page and maybe he'll show up next time."
If RobbyLoaded = True And RobbyShowFailed = False Then
Robby.Hide
End If
SayGoodbye
Else
StatusBar1.SimpleText = "Merlin character successfully loaded."
MerlinLoaded = True
Set Merlin = Agent.Characters("merlin")
Set GetRequest(7) = Merlin.Get("state", "showing,speaking", False)
Merlin.Get "animation", "blink", False
StatusBar1.SimpleText = "Loading Merlin's Showing and Speaking state animations."
End If
Case GetRequest(1) 'Request to load Genie's Showing and Speaking state animations
If Request.Status = 0 Or DatapathType = "UNC" Then
StatusBar1.SimpleText = "Genie's Showing and Speaking state animations loaded."
Genie.Get "animation", "greet", False
' If the animation loaded, start the intro
StartIntro
Else
StatusBar1.SimpleText = "Genie's Showing and Speaking state animations failed to load."
MsgBox "Unable to load Genie's Showing and Speaking animations. Try refreshing the page."
End If
Case GetRequest(2) 'Request to load Genie's LookLeft, GreetReturn, Blink animations
If Request.Status = 0 Or DatapathType = "UNC" Then
StatusBar1.SimpleText = "Genie's LookLeft, GreetReturn, and Blink animations loaded."
Genie.Play "RestPose"
Else
StatusBar1.SimpleText = "Genie's LookLeft, GreetReturn, and Blink animations failed to load."
End If
' Now process Genie's intro of Robby
GenieIntro
Case GetRequest(3) 'Request to load Robby's Wave animation
If Request = 0 Or DatapathType = "UNC" Then
StatusBar1.SimpleText = "Robby's Wave animation loaded."
Else
StatusBar1.SimpleText = "Robby's Wave animaton failed to load."
End If
RobbyIntro
Case GetRequest(4) 'Request to load Robby's LookRight animations
If Request.Status = 0 Or DatapathType = "UNC" Then
StatusBar1.SimpleText = "Robby's LookRight animations loaded"
Else
StatusBar1.SimpleText = "Robby's LookRight animation failed to load."
End If
RobbyExpl